        s<-s+1
        s1<-s1+samplesize
        s2<-s2+samplesize
}
s<-0
s2<-1
s1<-samplesize
while(s<=num)
{
        if(s1 > length(gene1[1,])-4)
        {
           s1<- length(gene1[1,])-4
        }
        sub<-seq(s2,s1,1)
        main1<-seq(1,s2,1)
        main2<-seq(s1+1,length(gene1[1,])-4,1)
        main<-c(main1[1:length(main1)-1],main2)
        print(main)
        s<-s+1
        s1<-s1+samplesize
        s2<-s2+samplesize
}
s<-0
s2<-1
s1<-samplesize
while(s<num)
{
        if(s1 > length(gene1[1,])-4)
        {
           s1<- length(gene1[1,])-4
        }
        sub<-seq(s2,s1,1)
        main1<-seq(1,s2,1)
        main2<-seq(s1+1,length(gene1[1,])-4,1)
        main<-c(main1[1:length(main1)-1],main2)
        print(main)
        s<-s+1
        s1<-s1+samplesize
        s2<-s2+samplesize
}
s<-0
s2<-1
s1<-samplesize
while(s<=num)
{
        if(s1 > length(gene1[1,])-4)
        {
           s1<- length(gene1[1,])-4
        }
        sub<-seq(s2,s1,1)
        main1<-seq(1,s2,1)
        main2<-seq(s1+1,length(gene1[1,])-4,1)
        main<-c(main1[1:length(main1)-1],main2)
        print(main)
        s<-s+1
        s1<-s1+samplesize
        s2<-s2+samplesize
}
main<-()
main<-c()
s<-0
s2<-1
s1<-samplesize
while(s<=num)
{
        if(s1 > length(gene1[1,])-4)
        {
           s1<- length(gene1[1,])-4
        }
        sub<-seq(s2,s1,1)
        main1<-seq(1,s2,1)
         if(s1 > length(gene1[1,])-4)
        {
                main2<-c()
        }
        else
        {
                main2<-seq(s1+1,length(gene1[1,])-4,1)
        }
        main<-c(main1[1:length(main1)-1],main2)
        print(main)
        s<-s+1
        s1<-s1+samplesize
        s2<-s2+samplesize
}
s<-0
s2<-1
s1<-samplesize
while(s<=num)
{
        if(s1 > length(gene1[1,])-4)
        {
           s1<- length(gene1[1,])-4
        }
        sub<-seq(s2,s1,1)
        main1<-seq(1,s2,1)
        if(s1 == length(gene1[1,])-4)
        {
                main2<-c()
        }
        else
        {
                main2<-seq(s1+1,length(gene1[1,])-4,1)
        }
        main<-c(main1[1:length(main1)-1],main2)
        print(main)
        s<-s+1
        s1<-s1+samplesize
        s2<-s2+samplesize
}
sub
dim(geno1)
dim(gene1)
eqtlgene<-gene[i,5:ncol(gene1)]
        eqtlgeno<-as.matrix(geno1[8:ncol(geno1)])
i<-1
eqtlgene<-gene1[i,5:ncol(gene1)]
        eqtlgeno<-as.matrix(geno1[8:ncol(geno1)])
dim(eqtlgeno)
length(eqtlgene)
num<-0
s<-0
        s2<-1
        s1<-samplesize
        while(s<=num)
        {
                if(s1 > length(gene1[1,])-4)
                {
                s1<- length(gene1[1,])-4
                }
                sub<-seq(s2,s1,1)
                main1<-seq(1,s2,1)
                if(s1 == length(gene1[1,])-4)
                {
                        main2<-c()
                }
                else
                {
                        main2<-seq(s1+1,length(gene1[1,])-4,1)
                }
                main<-c(main1[1:length(main1)-1],main2)
                print(main)
                s<-s+1
                s1<-s1+samplesize
                s2<-s2+samplesize
        }
main
sub
eqtlgene<-as.matrix(eqtlgene)
geneeqtl<-eqtlgene[,sub]
genomaineqtl<-eqtlgeno[,main]
genosubeqtl<-eqtlgeno[,sub]
glm1 <- glm(geno1 ~ gnp1+gnp2+gnp3, data=d,family=gaussian(link="log"))
glm1 <- glm(geneeqtl ~ genomaineqtl, data=d,family=gaussian(link="log"))
data<-data.frame(genomaineqtl,geneeqtl)
dim(genomaineqtl)
dim(geneeqtl)
geneeqtl<-eqtlgene[,sub]
geneeqtl
geneeqtl<-eqtlgene[,main]
data<-data.frame(genomaineqtl,geneeqtl)
dim(geneeqtl)
geneeqtl<-eqtlgene[,main]
dim(geneeqtl)
length(geneeqtl)
dim(genomaineqtl)
geneeqtl<-t(as.matrix(eqtlgene[,main]))
data<-data.frame(genomaineqtl,geneeqtl)
data[1,]
data[2,]
dim(geneeqtl)
dim(genemaineqtl)
dim(genomaineqtl)
dim(data)
data<-as.data.frame(cbind(genomaineqtl,geneeqtl))
data<-as.data.frame(rbind(genomaineqtl,geneeqtl))
dim(data)
data<-t(data)
dim(data)
data[1,1:5]
data[1,424:428]
z<-1
seq<-seq(1,ncol(data)-1,1)
seq
genos<-seq(1,ncol(data)-1,1)
cols<-c(genos,"gene")
colnames(data)<-cols
genos<-""
while(z<ncol(data)){genos<-paste(genos,z,sep='+');z<-z+1;}
genos
z<-1
genos<-"1"
while(z<ncol(data)-1){genos<-paste(genos,z+1,sep='+');z<-z+1;}
genos
glm1 <- glm(geno1 ~ gnp1+gnp2+gnp3, data=d,family=gaussian(link="log"))
glm1 <- glm(gene ~ genos, data=d,family=gaussian(link="log"))
glm1 <- glm(gene ~ genos, data=data,family=gaussian(link="log"))
glm1 <- glm(gene ~ genos, data=as.data.frame(data),family=gaussian(link="log"))
dim(data)
genos<-paste(gene,genos,sep='~')
genos
genos<-paste("gene",genos,sep='~')
genos
genos
dim(data)
genos<-seq(1,ncol(data)-1,1)
                        cols<-c(genos,"gene")
                        colnames(data)<-cols
                        z<-1
                        genos<-"1"
                        while(z<ncol(data)-1){genos<-paste(genos,z+1,sep='+');z<-z+1;}
genos
genos<-paste("gene",genos,sep=' ~ ')
genos
glm1 <- glm(genos, data=as.data.frame(data),family=gaussian(link="log"))
glm1 <- glm(genos, data=data,family=gaussian(link="log"))
d<-as.data.frame(data)
glm1 <- glm(genos, data=d,family=gaussian(link="log"))
colnames(data)
data$gene[1:4]
data$gene
d<-as.data.frame(data)
colnames(d)<-colnames(data)
colnames(d)
d$gene
glm1 <- glm(genos, data=d,family=gaussian(link="log"))
genos
dim(d)
d[1,]
savehistory("temp.R")
geneeqtl<-t(as.matrix(eqtlgene[,main]))
                        genomaineqtl<-eqtlgeno[,main]
                        genosubeqtl<-eqtlgeno[,sub]
                        data<-as.data.frame(rbind(genomaineqtl,geneeqtl))
                        genos<-seq(1,ncol(data)-1,1)
                        cols<-c(genos,"gene")
                        colnames(data)<-cols
                        z<-1
                        genos<-"1"
                        while(z<ncol(data)-1){genos<-paste(genos,z+1,sep='+');z<-z+1;}
dim(data)
geneeqtl<-t(as.matrix(eqtlgene[,main]))
                        genomaineqtl<-eqtlgeno[,main]
                        genosubeqtl<-eqtlgeno[,sub]
                        data<-as.data.frame(t(rbind(genomaineqtl,geneeqtl)))
                        genos<-seq(1,ncol(data)-1,1)
                        cols<-c(genos,"gene")
                        colnames(data)<-cols
                        z<-1
                        genos<-"1"
                        while(z<ncol(data)-1){genos<-paste(genos,z+1,sep='+');z<-z+1;}
dim(data)
colnames(data)
genos
genos<-paste("gene",genos,sep=' ~ ')
genos
d<-as.data.frame(data)
colnames(d)<-colnames(data)
glm1 <- glm(genos, data=d,family=gaussian(link="log"))
glm1 <- glm(gene ~ 1+2, data=d,family=gaussian(link="log"))
glm1 <- glm(data[,428] ~ data[,1]+data[,2], data=d,family=gaussian(link="log"))
glm1 <- glm(d[,428] ~ d[,1]+d[,2], data=d,family=gaussian(link="log"))
glm1 <- glm(d[,429] ~ d[,1]+d[,2], data=d,family=gaussian(link="log"))
paste(1,2,3,sep=".")
genos<-"data[,1]"
genos
while(z<ncol(data)-1){genos<-paste(genos,'+data[,',z,']',sep='');z<-z+1;}
z
genos
genos<-paste(genos,'+data[,',z,']',sep='')
genos
ncol(data)
genos
genos<-paste(genos,'+data[,',z,']',sep='')
genos
genos<-"data[,1]"
while(z<ncol(data)-1){genos<-paste(genos,'+data[,',z,']',sep='');z<-z+1;}
genos
z
z<-1
while(z<ncol(data)-1){genos<-paste(genos,'+data[,',z,']',sep='');z<-z+1;}
genos
z<-1
while(z<ncol(data)-1){genos<-paste(genos,'+data[,',z+1,']',sep='');z<-z+1;}
genos
z<-1

while(z<ncol(data)-1){genos<-paste(genos,'+data[,',z+1,']',sep='');z<-z+1;}
genos
glm1 <- glm(d[,428] ~ genos, data=d,family=gaussian(link="log"))
genos<-paste('data[,',ncol(data),'] ~ ',genos,paste='')
genos
glm1 <- glm(genos, data=d,family=gaussian(link="log"))
glm1
dim(d)
dim(data)
geneeqtl<-t(as.matrix(eqtlgene[,main]))
                        genomaineqtl<-eqtlgeno[,main]
                        genosubeqtl<-eqtlgeno[,sub]
                        #data<-as.data.frame(t(rbind(genomaineqtl,geneeqtl)))
                        data<-as.data.frame(rbind(genomaineqtl,geneeqtl))
                        genos<-seq(1,ncol(data)-1,1)
                        cols<-c(genos,"gene")
                        colnames(data)<-cols
                        z<-1
                        genos<-"data[,1]"
                        while(z<ncol(data)-1){genos<-paste(genos,'+data[,',z+1,']',sep='');z<-z+1;}
                        genos<-paste('data[,',ncol(data),'] ~ ',genos,paste='')
                        data[1,]
geneeqtl<-t(as.matrix(eqtlgene[,main]))
                        genomaineqtl<-eqtlgeno[,main]
                        genosubeqtl<-eqtlgeno[,sub]
                        #data<-as.data.frame(t(rbind(genomaineqtl,geneeqtl)))
                        data<-as.data.frame(t(rbind(genomaineqtl,geneeqtl)))
data[1,]
ncol(data)
nrow(data)
data[,428]
data[,427]
glm1 <- glm(genos, data=d,family=gaussian(link="log"))
genos
glm1
dim(geneeqtl)
dim(genemaineqtl)
dim(genomaineqtl)
data<-as.data.frame(t(rbind(genomaineqtl,geneeqtl)))
dim(data)
z<-1
                        genos<-"data[,1]"
                        while(z<ncol(data)-1){genos<-paste(genos,'+data[,',z+1,']',sep='');z<-z+1;}
                        genos<-paste('data[,',ncol(data),'] ~ ',genos,paste='')
genos
glm1 <- glm(genos, data=data,family=gaussian(link="log"))
glm1
dim(data)
data[,1]
ncol(data)
nrow(data)
data[,428]
data<-as.data.frame(t(rbind(genomaineqtl,geneeqtl)))
dim(data)
data[337,]
data<-c()
data<-as.data.frame(t(rbind(genomaineqtl,geneeqtl)))
data[1,]
detach(data) 
data<-is.null()
data<-is.null(data)
data
data<-as.data.frame((rbind(genomaineqtl,geneeqtl)))
dim(data)
data[,1]
data<-t(data)
data[,1]
dim(data)
data[1,]
dim(data)
glm1 <- glm(genos, data=data,family=gaussian(link="log"))
genos
glm1 <- glm(genos, data=as.data.frame(data),family=gaussian(link="log"))
glm1
genos
data[1,]
nrow(data)
ncol(data)
glm1 <- glm(genos, data=as.data.frame(t(data)),family=gaussian(link="log"))
dim(data)
k<-data[1,]
length(k)
k
colnames(data)<-c()
rownames(data)<-c()
glm1 <- glm(genos, data=as.data.frame(data),family=gaussian(link="log"))
glm1
genos
glm1
colnames(data)
dim(data)
data<-as.data.frame(data)
dim(data)
glm1 <- glm(genos, data=data,family=gaussian(link="log"))
glm1
geneeqtl<-t(as.matrix(eqtlgene[,main]))
                        genomaineqtl<-eqtlgeno[,main]
                        genosubeqtl<-eqtlgeno[,sub]
                        #data<-as.data.frame(t(rbind(genomaineqtl,geneeqtl)))
                        data<-as.data.frame(t(rbind(genomaineqtl,geneeqtl)))
                        genos<-seq(1,ncol(data)-1,1)
                        cols<-c(genos,"gene")
                        colnames(data)<-cols
dim(data)
colnames(data)
d<-as.data.frame(data)
colnames(d)<-colnames(data)
attach(d)
d$gene
gene

                        genos<-seq(1,ncol(data)-1,1)
t<-1
genos<-c()
genos<-"1"
genos<-seq(paste(1,"g",sep=","),ncol(data)-1,1)
t
ncol(data)
geneeqtl<-t(as.matrix(eqtlgene[,main]))
dim(geneeqtl)
arr<-c()
while(t<ncol(data)){arr[t]<-paste("g",t,sep="");t<-t+1}
arr
arr[ncol(data)] = "gene"
dim(data)
colnames(data)<-cols
attach(data)
data$g1
data$g2
data$gene
colnames(data)
colnames(data)<-arr
colnames(data)
attach(data)
data$g1
genos<-"g1"
genos<-"data$g1"
while(z<ncol(data)-1){genos<-paste(genos,'+data$g',z+1,,sep='');z<-z+1;}
genos
z<-1
while(z<ncol(data)-1){genos<-paste(genos,'+data$g',z+1,,sep='');z<-z+1;}
genos<-"data$g1"
while(z<ncol(data)-1){genos<-paste(genos,'+data$g',z+1,,sep='');z<-z+1;}
while(z<ncol(data)-1){genos<-paste(genos,'+data$g',z+1,sep="");z<-z+1;}
genos
genos<-paste("data$gene",genos,sep="~")
genos
glm1 <- glm(genos, data=data,family=gaussian(link="log"))
glm1
data$g337
glm1
genos
glm1 <- glm(genos, data=data,family=gaussian(link="log"))
glm1
data$g336 
summary(data)
data$g336 
glm1
covd<-cov(data)
heatmap(covd)
pdf("heatmap.cov")
heatmap(covd)
dev.off()
dev.off()
pdf("heatmap.cov")
heatmap(covd)
dev.off()
pdf("ordered_heatmap_of_cov.pdf")
heatmap(covd,Rowv=NA,Colv=NA)
dev.off()
gene1[1,]
genos
glm1 <- glm(data$gene~data$g1, data=data,family=gaussian(link="log"))
glm1
glm1 <- glm(data$gene~data$g380, data=data,family=gaussian(link="log"))
glm1
glm1 <- glm(data$gene~data$g1, data=data,family=gaussian(link="log"))
pred <- predict(glm1, newdata=data.frame(genosubeqtl[1,]), type="response")
dim(genosubeqtl)
genosubeqtl[1,]
data.frame(genosubeqtl[1,])
pred <- predict(glm1, newdata=t(data.frame(genosubeqtl[1,])), type="response")
pred <- predict(glm1, newdata=data.frame(t(genosubeqtl[1,])), type="response")
newdata
data.frame(t(genosubeqtl[1,]))
pred <- predict(glm1, nta=data.frame(t(genosubeqtl[1,])), type="response")
pred
pred <- predict(glm1, nta=data.frame(genosubeqtl[1,]), type="response")
pred
vec1<-as.vector(genosubeqtl[1,])
vec1<-as.data.frame(vec1)
dim(vec1)
pred <- predict(glm1, vec1, type="response")
vec1
d1 <- data.frame(geneeqtl[1,],genomaineqtl[1,])
glm1 <- glm(d1$gene ~ d1$genot, data=d1,family=gaussian(link="log"))
colnames(d1)<-c("gene","genotype")
d1$gene
summary(d1)
 glm1 <- glm(d1$gene ~ d1$genotype, data=d1,family=gaussian(link="log"))
glm1
pred <- predict(glm1, vec1, type="response")
d1$genotype
d1$gene
 glm1 <- glm(d1$gene ~ d1$genotype, data=d1,family=gaussian(link="log"))
vec1
pred <- predict(glm1, vec1, type="response")
 glm1 <- glm(dgene ~ genotype, data=d1,family=gaussian(link="log"))
 glm1 <- glm(gene ~ genotype, data=d1,family=gaussian(link="log"))
pred <- predict(glm1, vec1[0], type="response")
head(d1)
d1[1,]
summary(d1)
 glm1 <- glm(gene ~ genotype, data=d1,family=gaussian(link="log"))
pred <- predict(glm1, 6, type="response")
help(predict)
pred <- predict(glm1, data.frame(cbind(genotype=c(5))), type="response")
pred
pred <- predict(glm1, data.frame(cbind(genotype=vec1)), type="response")
vec1
colnames(vec1)<-c("genotype")
pred <- predict(glm1, data.frame(cbind(genotype=vec1)), type="response")
pred
savehistory("temp.R"0
savehistory("temp.R")
